﻿@{
    ViewBag.Title = "优惠活动";
    Layout = "~/Views/Shared/_layoutPersonal.cshtml";
}
@Styles.Render("~/Content/css/business")
<nav class="mod_nav">
    <div class="lay_left">
        <a class="nav_back" onclick="turnBack()"><img src="/images/TurnBackNormal.png"></a>
        <span id="promotionTitleHelp"></span>
    </div>
</nav>
<div class="IndexBanner IndexPart">
    <img id="promotionImage" alt="优惠活动" />
</div>
<section id="goodsList" class="IndexGoods fll Activity"></section>
<section class="Shopping"></section>
<section class="OrderGray" onclick="hideShoppingCar()"></section>
<script>
    window.onload = function () {
        var promotionGoodsInfo = PromotionMgr.getPromotionGoodsInfo();
        adjustPromotionBaseShow(promotionGoodsInfo);
        loadShopping();
        PromotionMgr.getPromotionGoodsListInfo(promotionGoodsInfo, 0, PromotionMgr.queryGoodsNum, getPromotionGoodsListCallback);
    }

    function turnBack() {
        window.location.href = '@Url.Content("~/")' + 'Home/Index';
    }

    function adjustPromotionBaseShow(promotionGoodsInfo) {
        $("#promotionTitleHelp").text(promotionGoodsInfo.goods_info.name);
        $("#promotionImage").attr("src", promotionGoodsInfo.goods_info.image);

    }

    function getPromotionGoodsListCallback(goodsList) {
        if (null != goodsList && goodsList.length > 0) {
            var url = '@Url.Content("~/")' + 'Promotion/GetPromotionGoodsInfo';
            NativeAjax(goodsList, url, function (msg) { loadPartialViewResult(msg, $("#goodsList"), 1); });
        }
    }
    function loadShopping() {
        var shoppingList = ShoppingMgr.getShoppingList();
        var url = '@Url.Content("~/")' + 'Home/Shopping';
        NativeAjax(shoppingList, url, function (msg) {
            loadPartialViewResult(msg, $(".Shopping"), 1);
        });
    }
</script>